package com.mtsmda.bookjava7.chapter11;

public class Surprise {

	public static void main(String[] args) {
		booleanEx();
		System.out.println("-----");
		integerEx();
	}

	private static final void booleanEx() {
		Boolean b1 = true;
		Boolean b2 = true;
		System.out.println("b1 == b2 - " + (b1 == b2));
		System.out.println("b1.equals(b2) - " + b1.equals(b2));

		Boolean b3 = new Boolean(false);
		Boolean b4 = new Boolean(false);
		System.out.println("b3 == b4 - " + (b3 == b4));
		System.out.println("b3.equals(b4) - " + b3.equals(b4));
	}

	private static final void integerEx() {
		Integer i1 = 15;
		Integer i2 = 15;
		System.out.println("i1 == i2 - " + (i1 == i2));
		System.out.println("i1.equals(i2) - " + (i1.equals(i2)));
		System.out.println();
		Integer i3 = new Integer(i1);
		Integer i4 = new Integer(i2);
		System.out.println("i3 == i4 - " + (i3 == i4));
		System.out.println("i3.equals(i4) - " + (i3.equals(i4)));
		System.out.println();
System.out.println("integer");
		Integer i5 = 128;
		Integer i6 = 128;
		System.out.println("i5 == i6 - " + (i5 == i6));
		System.out.println("i5.equals(i6) - " + (i5.equals(i6)));
		System.out.println();
		Integer i7 = new Integer(i5);
		Integer i8 = new Integer(i6);
		System.out.println("i7 == i8 - " + (i7 == i8));
		System.out.println("i7.equals(i8) - " + (i7.equals(i8)));
		System.out.println();
	}
}